diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2025-01-15 16:29:48 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2025-01-15 16:29:48 +0700 |
| commit | 98236a47c3558c4b701009a275c7ae917ee8bf67 (patch) | |
| tree | 21e0300680a724c8a24ed815ea4e9a32ab13a895 /src/pages/pengajuan-tempo/[status].jsx | |
| parent | 1fa1a7873aa67cdd9ca211c239276a148cd4cdda (diff) | |
| parent | 7a14ed5ccdde86d0400d6aa02ac866317d4add63 (diff) | |
Merge branch 'new-release' into Feature/switch-account
# Conflicts:
# src/lib/auth/components/CompanyProfile.jsx
# src/lib/auth/components/Menu.jsx
Diffstat (limited to 'src/pages/pengajuan-tempo/[status].jsx')
| -rw-r--r-- | src/pages/pengajuan-tempo/[status].jsx | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/pages/pengajuan-tempo/[status].jsx b/src/pages/pengajuan-tempo/[status].jsx new file mode 100644 index 00000000..29886892 --- /dev/null +++ b/src/pages/pengajuan-tempo/[status].jsx @@ -0,0 +1,47 @@ +import BasicLayout from '@/core/components/layouts/BasicLayout'; +import IsAuth from '@/lib/auth/components/IsAuth'; +import FinishTempoComponent from '@/lib/pengajuan-tempo/component/FinishTempo'; +import { useRouter } from 'next/router'; +import axios from 'axios'; +import { useState, useEffect } from 'react'; +import Seo from '@/core/components/Seo'; +import { getAuth } from '~/libs/auth'; + +export async function getServerSideProps(context) { + const { status } = context.query; + await axios.post( + `${process.env.NEXT_PUBLIC_SELF_HOST}/api/pengajuan-tempo/${status}`, + {}, + { headers: context.req.headers } + ); + return { props: {} }; +} + +export default function Finish() { + const [isLoading, setIsLoading] = useState(true); + const router = useRouter(); + const auth = getAuth(); + useEffect(() => { + if (!auth) { + const nextUrl = encodeURIComponent(router.asPath); + router.push(`/login?next=${nextUrl}`); + } else { + setIsLoading(false); + } + }, [auth]); + + if (isLoading || !auth) { + return null; // Tidak render apa pun selama loading atau auth/tempo belum tersedia + } + return ( + <> + <Seo title='Pengajuan Tempo Indoteknik.com' /> + + <IsAuth> + <BasicLayout> + <FinishTempoComponent query={router.query || {}} /> + </BasicLayout> + </IsAuth> + </> + ); +} |
